# simple_test.py
import sys
import os

# 添加项目路径
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from agents.intent_classifier import IntentRecognitionAgent
from models.state import WorkflowState

def main():
    """简单的交互式意图识别"""
    agent = IntentRecognitionAgent()
    
    print("=== 意图识别系统 ===")
    print("输入您的问题，系统将识别查询意图")
    print("输入 '退出' 结束程序")
    print("-" * 40)
    
    while True:
        user_input = input("\n请输入问题: ").strip()
        
        if user_input in ['退出', 'quit', 'exit']:
            print("再见！")
            break
            
        if not user_input:
            continue
            
        # 处理查询
        state = WorkflowState(user_input=user_input)
        result_state = agent.process(state)
        
        # 显示结果
        print(f"识别意图: {result_state.intent}")
        print(f"类型: {result_state.intent_details['description']}")
        
        # 如果有澄清问题，显示给用户
        if result_state.intent_details.get('waiting_for_clarification', False):
            clarification = result_state.intent_details.get('clarification_question')
            if clarification:
                print(f"\n🔍 澄清询问: {clarification}")

if __name__ == "__main__":
    main()